From 6f6c1d7919a71b9445c4cfb006ea0fbd6815693b Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Wed, 4 Jun 2003 12:24:19 +0000 Subject: [PATCH] bitkeeper revision 1.251 (3edde4f3E2DAGrzTEG2ZDkYKtez4fQ) setup.c, head.S: Fix IOPL handling in Xenolinux. --- xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/head.S | 5 ++++- xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/setup.c | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/head.S b/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/head.S index a89fd8eda4..6278ececb3 100644 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/head.S +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/head.S @@ -50,8 +50,11 @@ startup_32: jmp SYMBOL_NAME(start_kernel) +# Stack is 8kB. We leave 100 bytes trailer for fake 'pt_regs'. +# This is needed so that iopl checks of the saved eflags register +# work correctly, for example. ENTRY(stack_start) - .long SYMBOL_NAME(init_task_union)+8192, __KERNEL_DS + .long SYMBOL_NAME(init_task_union)+8192-100, __KERNEL_DS .org 0x1000 ENTRY(empty_zero_page) diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/setup.c b/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/setup.c index cc53983f34..21db2e8f01 100644 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/setup.c +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/setup.c @@ -143,6 +143,7 @@ static void __init parse_mem_cmdline (char ** cmdline_p) void __init setup_arch(char **cmdline_p) { + struct pt_regs *regs = ((struct pt_regs *)current->thread.esp0) - 1; unsigned long start_pfn, max_pfn, max_low_pfn; unsigned long bootmap_size; unsigned long i; @@ -301,10 +302,15 @@ void __init setup_arch(char **cmdline_p) paging_init(); - if ( start_info.flags & SIF_PRIVILEGED ) + /* Set privilege level gubbins. */ + regs->eflags &= ~(3<<12); + if ( start_info.flags & SIF_PRIVILEGED ) { /* We are privileged guest os - should have IO privileges. */ if( HYPERVISOR_set_priv_levels(1, 1) ) panic("Unable to obtain IOPL, despite being SIF_PRIVILEGED"); + regs->eflags |= 1<<12; + } + current->thread.hypercall_pl = 1; if(start_info.flags & SIF_CONSOLE) { -- 2.30.2